/**
 * 通过 setter 截听输入属性值的变化
 */

import { Component, Input, HostBinding } from '@angular/core';

@Component({
  selector: 'name-child',
  template: `
    <h3>"{{name}}"</h3> 
  `
})
export class NameChildComponent {
  _name: string = '<no name set>';

  // @Input() name = name;

  @Input()
  set name(name: string) {
    this._name = (name && name.trim()) || '<no name set>';
    // this._name = name;
  }

  get name() { 
    return this._name; 
  }

}

